import { createRouter, createWebHistory } from 'vue-router'
import VueRouter from 'vue-router'
import Index from '../views/Index.vue'
import BusinessList from '../views/BusinessList.vue'
import BusinessInfo from '../views/BusinessInfo.vue'
import Login from '../views/Login.vue'
import Orders from '../views/Orders.vue'
import UserAddress from '../views/UserAddress.vue'
import Payment from '../views/Payment.vue'
import OrderList from '../views/OrderList.vue'
import AddUserAddress from '../views/AddUserAddress.vue'
import EditUserAddress from '../views/EditUserAddress.vue'
import Register from '../views/Register.vue'
import Discover from '../views/Discover.vue'  // 引入“发现”页面组件
import PaySuccessfully from '../views/PaySuccessfully.vue'
import MyProfile from '../views/MyProfile.vue';  // 导入新组件
import UpdateUserName from '../views/UpdateUserName.vue';
import UpdateUserPassword from '../views/UpdateUserPassword.vue'
import ChoseLogin from '../views/ChoseLogin.vue'
import Transaction from '../views/Transaction.vue'; // 这里导入 Transaction.vue
import BusinessLogin from '../views/BusinessLogin.vue'
import BusinessRegister from '../views/BusinessRegister.vue'
import BusinessOrder from '../views/BusinessOrder.vue'
import BusinessManage from '../views/BusinessManage.vue'
import BusinessProfile from '../views/BusinessProfile.vue'
import UpdateBusinessName from '../views/UpdateBusinessName.vue'
import UpdateBusinessPassword from '../views/UpdateBusinessPassword.vue'
import UpdateBusinessAddress from '../views/UpdateBusinessAddress.vue'
import UpdateBusinessExplain from '../views/UpdateBusinessExplain.vue'
import UpdateOrderTypeld from '../views/UpdateOrderTypeld.vue'
import UpdatestarPrice from '../views/UpdatestarPrice.vue'
import UpdatedeliveryPrice from '../views/UpdatedeliveryPrice.vue'
import Updateremark from '../views/Updateremark.vue'
import MenuManage from '../views/MenuManage.vue'
import AddMenu from '../views/AddMenu.vue'
import ChangeMenu from '../views/ChangeMenu.vue'

const routes = [
	{
		path: '/discover',  // 添加“发现”页面的路由
		name: 'Discover',
		component: Discover
	},{
		path: '/',
		name: 'Home',
		component: Index
	}, {
		path: '/index',
		name: 'Index',
		component: Index
	}, {
		path: '/businessList',
		name: 'BusinessList',
		component: BusinessList
	}, {
		path: '/businessInfo',
		name: 'BusinessInfo',
		component: BusinessInfo
	}, {
		path: '/login',
		name: 'Login',
		component: Login
	}, {
		path: '/businesslogin',//商家登录
		name: 'BusinessLogin',
		component:BusinessLogin
	}, {
		path: '/orders',
		name: 'Orders',
		component: Orders
	},{
		path:'/businessorder',//添加商家订单管理界面
		name:'BusinessOrder',
		component:BusinessOrder
	},{
		path: '/userAddress',
		name: 'UserAddress',
		component: UserAddress
	}, {
		path: '/payment',
		name: 'Payment',
		component: Payment
	}, {
		path: '/orderList',
		name: 'OrderList',
		component: OrderList
	}, {
		path: '/addUserAddress',
		name: 'AddUserAddress',
		component: AddUserAddress
	}, {
		path: '/editUserAddress',
		name: 'EditUserAddress',
		component: EditUserAddress
	}, {
		path: '/register',
		name: 'Register',
		component: Register
	}, {
		path: '/businessregister',
		name: 'BusinessRegister',
		component: BusinessRegister
	}, {
		path: '/paySuccessfully',
		name: 'PaySuccessfully',
		component: PaySuccessfully
	}, {
		path: '/myProfile',  
		name: 'MyProfile',
		component: MyProfile  // 新的路由
	},{
		path:'/businessprofile',
		name:'BusinessProfile',
		component:BusinessProfile
	},{
		path:'/businessmanage',
		name:'BusinessManage',
		component:BusinessManage
	},{
		path: '/choselogin', //添加选择身份页面
		name: 'ChoseLogin',
		component:ChoseLogin

	},{
		path: '/updateUserName',
		name: 'UpdateUserName',
		component: UpdateUserName
   	},{
		path: '/updateUserPassword',
		name: 'UpdateUserPassword',
		component: UpdateUserPassword
	},{
		path: '/updateBusinessPassword',
		name: 'UpdateBusinessPassword',
		component: UpdateBusinessPassword
	},{
		path: '/transaction',  // 路径
		name: 'Transaction',
		component: Transaction  // 组件
  	},{
		path: '/updateBusinessAddress',  // 路径
		name: 'UpdateBusinessAddress',
		component: UpdateBusinessAddress // 组件
  	},{
		path: '/updateBusinessExplain',  // 路径
		name: 'UpdateBusinessExplain',
		component: UpdateBusinessExplain // 组件
  	},{
		path: '/updateOrderTypeId',  // 路径
		name: 'UpdateOrderTypeId',
		component: UpdateOrderTypeld // 组件
  	},{
		path: '/updatestarPrice',  // 路径
		name: 'UpdatestarPrice',
		component: UpdatestarPrice // 组件
  	},{
		path: '/updatedeliveryPrice',  // 路径
		name: 'UpdatedeliveryPrice',
		component: UpdatedeliveryPrice // 组件
  	},{
		path: '/updateremark',  // 路径
		name: 'Updateremark',
		component: Updateremark // 组件
  	},,{
		path:'/menumanage',
		name:'MenuManage',
		component:MenuManage
	},,{
		path:'/addmenu',
		name:'AddMenu',
		component:AddMenu
	},{
		path:'/changemenu',
		name:'ChangeMenu',
		component:ChangeMenu
	},{
		path: '/updatebusinessName',
		name: 'UpdateBusinessName',
		component: UpdateBusinessName
}

]

// //解决重复路由报异常问题
// const originalPush = VueRouter.prototype.push;
// VueRouter.prototype.push = function push(location) {
// 	return originalPush.call(this, location).catch(err => err)
// }

const router = createRouter({
	history: createWebHistory(process.env.BASE_URL),
	routes
})
  

export default router